---@class Table_GlobalDataItem
local Table_GlobalDataItem = class("Table_GlobalDataItem");

function Table_GlobalDataItem:ctor()
    self.Id = 0;    --唯一ID
    self.IntParam = 0;    --参数Int
    self.FloatParam = 0;    --参数Float
    self.BooleanParam = false;    --参数Boolean
    self.StringParam = "";    --参数String
end

function Table_GlobalDataItem:Load(reader)
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Id = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.IntParam = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.FloatParam = tonumber(self.temp); end
    self.BooleanParam = reader:ReadBool();
    self.StringParam = reader:ReadString();
    self.temp = nil;
end

---@class Table_GlobalDataMgr : IDataMgr
local Table_GlobalDataMgr = class("Table_GlobalDataMgr", IDataMgr);

function Table_GlobalDataMgr:FileName()
    return "Txt/GlobalData.txt";
end

---@return Table_GlobalDataItem
function Table_GlobalDataMgr:GetItemById(id)
    return self.super:GetItemById(id)
end

---@return Table_GlobalDataItem
function Table_GlobalDataMgr:GetItemByIdx(idx)
    return self.super:GetItemByIdx(idx)
end

function Table_GlobalDataMgr:Load(reader)
    local item = Table_GlobalDataItem.new();
    item:Load(reader);
    self.mItemDic[item.Id] = self.mDataCount;
    table.insert(self.mItemList, item);
end

return Table_GlobalDataMgr;